import request from '@/utils/request'
/**
 * 获取用户列表
 *@returns 用户
 */
export function getUserListApi(params) {
  return request({
    url: '/users',
    method: 'GET',
    params
  })
}
/**
 * 添加用户
 *@returns 用户
 */
export function PostUserApi(data) {
  return request({
    url: '/users',
    method: 'POST',
    data
  })
}
/**
 * 获取用户详情
 *@returns 用户
 */
export function getUserdetailApi(id) {
  return request({
    url: `/users/${id}`
  })
}
/**
 * 修改用户
 *@returns 用户
 */
export function editUserApi(data) {
  return request({
    url: `/users/${data.id}`,
    method: 'PUT',
    data
  })
}
/**
 * 删除用户
 *@returns 用户
 */
export function deleteUserApi(id) {
  return request({
    url: `/users/${id}`,
    method: 'DELETE'
  })
}
/**
 * 获取权限
 *@returns 用户
 */
export function getpermissionsListApi() {
  return request({
    url: '/permissions/simple'
  })
}

/**
 * 获取权限
 *@returns 菜单
 */
export function getMenuListApi() {
  return request({
    url: '/menus'
  })
}
/**
 * 新增权限
 *@returns 菜单
 */
export function PostMenuApi(data) {
  return request({
    url: '/menus',
    method: 'POST',
    data
    // export function transactionList(query) {
    //   return request({
    //     url: '/vue-element-admin/transaction/list',
    //     method: 'get',
    //     params: query
  })
}

/**
 * 用户列表
 * @param { Object } data
 * @returns
 */
export function getUserListSimpleApi() {
  return request({
    url: '/users/simple',
    method: 'get'
  })
}

/**
 * 删除菜单
 *@returns 菜单
 */
export function deleteMenuApi(id) {
  return request({
    url: `/menus/${id}`,
    method: 'DELETE'
  })
}
/**
 * 修改菜单
 *@returns 菜单
 */
export function reviseMenuApi(data) {
  return request({
    url: `/menus/${data.id}`,
    method: 'PUT',
    data
  })
}
/**
 * 修改菜单
 *@returns 菜单
 */
export function MenuApi(data) {
  return request({
    url: `/menus/${data.id}`,
    method: 'PUT'
  })
}
